<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>状态交互元素</title>
<style type="text/css">
body{
	font-size:13px
	}
p{
	padding:0px;
	margin:0px
	}
	/*不错的按钮样式*/
.inputbtn{
	border:solid 1px #ccc;
	background-color:#eee;
	line-height:18px;
	font-size:12px;
	}
</style>
</head>

<body>
<p id="pTip">开始下载</p>
<progress value="0" max="100" id="proDownFile"></progress>
<input type="button" onClick="Btn_Click();" value="下载" class="inputbtn" />
<script type="text/javascript">
var intValue=0;
var intTimer;
var objPro = document.getElementById('proDownFile');
var objTip = document.getElementById('pTip');
//定时事件
function Interval_handler(){
	intValue++;
	objPro.value = intValue;
	if(intValue >= objPro.max)
	{
		clearInterval(intTimer);
		objTip.innerHTML = "下载完成";
		} else{
		objTip.innerHTML = "正在下载" + intValue + "%";
		}
	}
	//下载按钮单击事件
function Btn_Click(){
	intTimer = setInterval(Interval_handler,100);
	}
</script>
</body>
</html>
